
def insert_bjmysql(sql):
    try:
        import pymysql
        db = pymysql.connect(host= "192.168.3.144",
                             user="gmgbj",
                             passwd='G7gIVYB9Xk^7',
                             port=3306,
                             charset='utf8',
                            db='strategy')

        cursor = db.cursor()

        # 使用 execute()  方法执行 SQL 查询
        cursor.execute(sql)

        # print(sql)
        # 关闭数据库连接
        db.commit()
    except Exception as e:
        print(e)
        db.rollback()
    db.close()